<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/6/13
 * Time: 23:01
 */
namespace app\common\model;

use think\Model;

class ArticleComment extends Model
{
    protected $table = 'wechatadmin.system_article_comment';

    protected $insert = ['create_time'];

    public function setCreateTimeAttr($value)
    {
        return time();
    }

    /**
     * 关联文章
     * @return \think\model\relation\belongsTo
     */
    public function article()
    {
        return $this->belongsTo('Article','id','aid');
    }

    /**
     * 关联评论的回复
     * @return \think\model\relation\HasMany
     */
    public function reply()
    {
        return $this->hasMany('ArticleCommentReply','comment_id','id');
    }


}